const KEY = "itcast_token";

// 将 token 保存带本地存储中
const setToken = token => localStorage.setItem(KEY, token);

// 从本地缓存中取出 token
const getToken = () => localStorage.getItem(KEY);

// 从本地缓存中移除token
const removeToken = () => localStorage.removeItem(KEY)

// 根据本地缓存中是否有token 来判断用户有没有登陆 
const isAuth = () => !!getToken()

export {setToken,getToken,removeToken,isAuth}
